package com.wx.chapter8;

/**
 * ClassName:Homework04
 * Package :com.wx.chapter8
 * Description :
 *
 * @Author : coder_mu
 * @Create : 2023/5/29 - 13:32
 */
public class Homework04 {
    public static void main(String[] args) {
        Manager jay = new Manager("jay", 100, 30, 1.3);
        jay.setBonus(1000);
        jay.printSal();

        Worker tim = new Worker("tim", 10, 30, 1.3);
        tim.printSal();
    }
}

class Employee {
    private String name;
    private double daySal;
    private int workDays;
    private double grade;

    //打印员工信息以及其工资
    public void printSal() {
        System.out.println(name + " 工资=" + daySal * workDays * grade);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getDaySal() {
        return daySal;
    }

    public void setDaySal(double daySal) {
        this.daySal = daySal;
    }

    public int getWorkDays() {
        return workDays;
    }

    public void setWorkDays(int workDays) {
        this.workDays = workDays;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }

    public Employee(String name, double daySal, int workDays, double grade) {
        this.name = name;
        this.daySal = daySal;
        this.workDays = workDays;
        this.grade = grade;
    }
}

class Worker extends Employee {

    public Worker(String name, double daySal, int workDays, double grade) {
        super(name, daySal, workDays, grade);
    }
    //重写打印方法

    @Override
    public void printSal() {
        System.out.println("普通员工信息");
        super.printSal();
    }
}

class Manager extends Employee {
    public Manager(String name, double daySal, int workDays, double grade) {
        super(name, daySal, workDays, grade);
    }

    //特有属性  奖金
    private double bonus;

    //重写打印方法
    @Override
    public void printSal() {
        System.out.println("经理 " + getName() + " 工资是="
                + (bonus + getDaySal() * getWorkDays() * getGrade()));
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }
}